package main

import (
	"fmt"
	"encoding/json"
)

type Student struct{
	Name string `json:"name"`
	Age int `json:"age"`
	Score int `json:"score"`
}

func main() {
	var stu Student = Student{"Cara", 16, 95}
	data, err := json.Marshal(stu)
	if err != nil {
		fmt.Println("JSON err:", err)
		return
	}
	fmt.Println(string(data))  // 类型是 []byte 转成 string 输出
}
